#include <iostream>
#include <unistd.h>
#include <string>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <cstdio>
using namespace std;

string terimal = "/dev/pts/1";

int main()
{
    int fd = open(terimal.c_str(), O_WRONLY);
    if(fd < 0)
    {
        cerr << "open terminal error" << endl; 
        return 1;
    }
    dup2(fd,1);
    //err << "fd: " << fd << endl; 
    printf("hello world\n");
    
    close(fd);
    return 0;
}

